package cn.tedu.pet;
/**01创建父类宠物类*/
public class Pet {
    String name;
    int full;//饱食度
    int happy;

    public Pet(String name) {
       this(name,50,50);
    }
    public Pet(String name, int full, int happy) {
        this.name = name;
        this.full = full;
        this.happy = happy;
    }
    public void feed(){
        if (full==100){
            System.out.println("已经吃饱了，不要再喂了");
            return;
        }
        System.out.println("给"+name+"喂食");
        full+=10;//饱食度+10
        System.out.println("饱食度："+full);
    }
    public void play(){
        if (full<=10){
            System.out.println("已经饿得玩不动了");
            return;
        }
        System.out.println("陪"+name+"玩");
        happy+=10;
        full-=10;
        System.out.println("快乐度："+happy);
        System.out.println("饱食度："+full);
    }
    public void punish(){
        System.out.println("打"+name+"的pp，哭声："+cry());
        happy-=10;
        System.out.println(name+"的快乐度："+happy);
    }
    public String cry(){
        cry();//需要子类中重写，返回不同动物的哭叫声
        return "此处有哭叫声";//无意义代码，删了会报错
    }
}
